﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using OpenCvSharp;


namespace MultiRobot
{
    class RobotServer
    {
        private bool isDone = false;
        private int i = 0;
        private string message = "a";
        
        public void DoWork()
        {
            Program.form1.printlog("Robot Thread start...");
            while (!isDone) {
                Program.form1.printlog("Robot Thread working...");
                if (Program.form1.serialPort1.IsOpen) {
                    Program.form1.serialPort1.Write(message);
                    i++;
                }
                if (i == 5) {
                    i = 0;
                    message = "b";
                }

                Thread.Sleep(500);
            }
            Program.form1.printlog("Robot Thread exit...");
           
        }
        public void setDone() {
            isDone = true;
        }
    }
    
}
